package com.evry.sandox.batch;

import java.util.Date;

import com.evry.sandox.batch.domain.CollateralItem;
import com.evry.sandox.batch.exceptions.TimeOutWebServiceException;

public class WebServiceImpl {

	public void insertCollateralItem(CollateralItem item) throws Exception{
		System.out.println("TRYIGN TO PRIT ... " + item.toString());
		Thread.sleep(5000);
		if(Math.random()< 0.50){
			System.err.println("Time outed " + item.getName()  + " date: " + new Date());
			throw new TimeOutWebServiceException("Web service timed out trying to insert " + item.toString() + ".");
		}
		System.out.println("SUCCESFULLY PRINTED: " + item.toString());
	}
}
